<html>
<head><meta charset="utf-8"><title>Statement/expression effective scope · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Statement.2Fexpression.20effective.20scope.html">Statement/expression effective scope</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="232239110"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Statement/expression%20effective%20scope/near/232239110" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> ivan770 <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Statement.2Fexpression.20effective.20scope.html#232239110">(Mar 29 2021 at 09:19)</a>:</h4>
<p>Noob question. How can one obtain a statement/expression effective scope?<br>
Something like for</p>
<div class="codehilite"><pre><span></span><code>fn main() {
    let test = 123;
}
</code></pre></div>
<p>effective scope of <code>test</code> would be block of <code>main</code>, but for</p>
<div class="codehilite"><pre><span></span><code>fn main() {
    if let Some(test) = Some(123) {
        drop(test);
    }
}
</code></pre></div>
<p>effective scope of <code>test</code> would be block of <code>if</code> itself.</p>



<a name="232245336"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Statement/expression%20effective%20scope/near/232245336" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> ivan770 <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Statement.2Fexpression.20effective.20scope.html#232245336">(Mar 29 2021 at 10:13)</a>:</h4>
<p>Not sure why would anyone want such a thing for every available node, so I'll just stick to tree traversing</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>